<?php

/**
 * BaseService.class.php 
 * 
 *
 * @author     late.xiao@qq.com
 */
namespace Base\Lib;

class BaseService {

    public function __construct()
    {

    }
    
    public function proKeyVal($data, $is_created = true)
    {
        $result = array();
        foreach ($data as $key=>$val)
        {
            $tmp['s_key'] = $key;
            if(is_array($val))
            {
                $tmp['s_value'] = serialize($val);
                $tmp['s_type'] = 1;
            }
            else
            {
                $tmp['s_value'] = $val;
                $tmp['s_type'] = 0;
            }
            $tmp['updated'] = NOW_TIME;
            if($is_created)
            {
                $tmp['created'] = $tmp['updated'];
            }
            
            $result[] = $tmp;
        }
    
        return $result;
    }

}